package com.downloading.bezoyaapp.getData;

import java.util.ArrayList;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.downloading.bezoyaapp.entities.Alimento;
import com.downloading.bezoyaapp.entities.Pregunta;
import com.downloading.bezoyaapp.entities.Receta;

public class DBData implements ReadData {

	Context context;
	DB mDbHelper;
	SQLiteDatabase db;

	public DBData(Context context) {
		super();
		this.context = context;

		mDbHelper = new DB(context);
		db = mDbHelper.getReadableDatabase();

	}

	@Override
	public ArrayList<Receta> getAllRecetas() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ArrayList<Pregunta> getAllPreguntas() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Receta getRecetaById(int recetaId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ArrayList<Alimento> getAllAlimentos() {

		ArrayList<Alimento> alimentos = new ArrayList<Alimento>();

		String[] columnas = { "id", "name" };

		Cursor c = db.query("Alimento", columnas, null, null, null, null, "id");
		c.moveToFirst();

		do {

			Alimento alimento = new Alimento();

			int id = c.getInt(c.getColumnIndexOrThrow("id"));
			String name = c.getString(c.getColumnIndex("name"));

			alimento.setId(id);
			alimento.setName(name);
			
		} while (c.moveToNext());

		return null;
	}

	@Override
	public Alimento getAlimentoById(int alimentoId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ArrayList<Receta> getRecetasByAlimentoId(int almentoId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ArrayList<Alimento> getAlimentsoByRecetaId(int recetaId) {
		// TODO Auto-generated method stub
		return null;
	}

}
